<%@ page import="java.sql.SQLException" %>
<%@ page import="com.dao.UserDao" %>
<%@ page import="javax.naming.NamingException" %><%--
  Created by IntelliJ IDEA.
  User: 86152
  Date: 2020/10/15
  Time: 22:22
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>登录页面</title>
    <link rel="stylesheet" href="css/style.css">
    <link href='//fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>


    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="keywords"
          content="Simple Login Form Widget Responsive, Login Form Web Template, Flat Pricing Tables, Flat Drop-Downs, Sign-Up Web Templates, Flat Web Templates, Login Sign-up Responsive Web Template, Smartphone Compatible Web Template, Free Web Designs for Nokia, Samsung, LG, Sony Ericsson, Motorola Web Design"/>
    <script type="application/x-javascript"> addEventListener("load", function () {
        setTimeout(hideURLbar, 0);
    }, false);

    function hideURLbar() {
        window.scrollTo(0, 1);
    } </script>
</head>
<body>
<div class="contact">
    <div class="video_class">
        <div class="videos_res">
            <video  muted="muted" autoplay="autoplay" >
                <source src="img/login.mp4" type="video/mp4">
            </video>
        </div>
        <div class="bg_class">
            <div style=" margin: 3rem 5rem ; ">
                <a href="index.html"><img src="img/home.png" width="30px" align="right"/></a>
            </div>
            <div class="container w3">
                <h2>Login Now</h2>
                <form action="login.action" method="post" >
                    <div class="username">
                        <p><font color="red">${information}</font></p>
                        <span class="username">Username:</span>
                        <input type="text" name="username" class="name" required="required">
                        <div class="clear"></div>
                    </div>
                    <div class="password-agileits">
                        <span class="password">Password:</span>
                        <input type="password" name="password" class="password" required="required">
                        <div class="clear"></div>
                    </div>
                    <div class="rem-for-agile">
                        <input type="checkbox" name="remember" value="rem" class="remember">Remember me<br>
                    </div>
                    <div class="login-w3">
                        <input type="submit" class="login" value="Login">
                        <div class="clear"></div>
                    </div>
                </form>
            </div>
            <div class="footer-w3l">
                <p><a>&copy; Design by 云扑面</a></p>
            </div>
        </div>
    </div>
</div>
</body>
<%
    Cookie[] cookies = request.getCookies();
    if (cookies != null) {
        for (Cookie cookie : cookies) {
            String name = cookie.getName();
            String password = cookie.getValue();
            try {
                if (new UserDao().queryMethod(name, password)) {
                    ServletContext appliction = request.getServletContext();
                    appliction.setAttribute("username", name);
                    HttpSession session1 = request.getSession();
                    session1.setAttribute("filter", name);
                    request.getRequestDispatcher("/Input.jsp").forward(request, response);
                }
            } catch (SQLException e) {
                e.printStackTrace();
            } catch (NamingException e) {
                e.printStackTrace();
            }
        }
    }
%>


</html>
